package com.springboot.study.annotations;

import org.junit.Test;

import java.lang.reflect.Method;

/**
 * @Author: guodong
 * @Date: 2021/12/29 13:51
 * @Version: 1.0
 * @Description:
 */
public class TestAnnotation {

    @MyAnnotation("hello")
    @MyAnnotation("world")
    public void show() {
    }

    @Test
    public void test1() throws Exception {
        Class<TestAnnotation> aClass = TestAnnotation.class;
        Method show = aClass.getMethod("show");
        MyAnnotation[] annotations = show.getAnnotationsByType(MyAnnotation.class);
        for (MyAnnotation my : annotations) {
            System.out.println(my.value());
        }
    }


}
